package com.example.springboot_code_read.classPathBeanDefinitionScanner;

import com.example.springboot_code_read.bean.MyController;
import com.example.springboot_code_read.bean.MyRepository;
import com.example.springboot_code_read.bean.MyService;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.context.annotation.ClassPathBeanDefinitionScanner;

public class ClassPathBeanDefinitionScannerTest {

    public static void main(String[] args) {

        DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();

        ClassPathBeanDefinitionScanner beanDefinitionScanner = new ClassPathBeanDefinitionScanner(beanFactory);

        beanDefinitionScanner.scan("com.example.springboot_code_read.bean");

        System.out.println(beanFactory.getBean(MyRepository.class));
        System.out.println(beanFactory.getBean(MyService.class));
        System.out.println(beanFactory.getBean(MyController.class));

    }

}
